Remove unnecessary union in grant table map/unmap ops.
authorakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Sat, 13 Aug 2005 15:47:53 +0000 (15:47 +0000)
committerakw27@arcadians.cl.cam.ac.uk <akw27@arcadians.cl.cam.ac.uk>
Sat, 13 Aug 2005 15:47:53 +0000 (15:47 +0000)
All addresses, host virtual and PTEs, are now passed in the cunningly
ambiguous "host_addr" field, rather than in an anonymous union.

linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
linux-2.6-xen-sparse/drivers/xen/netback/netback.c
tools/libxc/xc_gnttab.c
xen/arch/ia64/grant_table.c
xen/common/grant_table.c
xen/include/public/grant_table.h

index 1121aeb56b1f56976f9388ca8f6b7bb638cf43e8..eb26470286f609f8e5fd07f943f6f32abaa6c54b 100644 (file)
@@ -120,10 +120,10 @@ static void fast_flush_area(int idx, int nr_pages)
     {
         if ( BLKBACK_INVALID_HANDLE != ( handle = pending_handle(idx, i) ) )
         {
-            unmap[i].host_virt_addr = MMAP_VADDR(idx, i);
+            unmap[i].host_addr      = MMAP_VADDR(idx, i);
             unmap[i].dev_bus_addr   = 0;
             unmap[i].handle         = handle;
-            pending_handle(idx, i) = BLKBACK_INVALID_HANDLE;
+            pending_handle(idx, i)  = BLKBACK_INVALID_HANDLE;
             invcount++;
         }
     }
@@ -383,7 +383,7 @@ static void dispatch_probe(blkif_t *blkif, blkif_request_t *req)
     {
         struct gnttab_map_grant_ref map;
 
-        map.host_virt_addr = MMAP_VADDR(pending_idx, 0);
+        map.host_addr = MMAP_VADDR(pending_idx, 0);
         map.flags = GNTMAP_host_map;
         map.ref = blkif_gref_from_fas(req->frame_and_sects[0]);
         map.dom = blkif->domid;
@@ -480,7 +480,7 @@ static void dispatch_rw_block_io(blkif_t *blkif, blkif_request_t *req)
             goto bad_descriptor;
         preq.nr_sects += seg[i].nsec;
 
-        map[i].host_virt_addr = MMAP_VADDR(pending_idx, i);
+        map[i].host_addr = MMAP_VADDR(pending_idx, i);
         map[i].dom = blkif->domid;
         map[i].ref = blkif_gref_from_fas(fas);
         map[i].flags = GNTMAP_host_map;
index b62c2d345d0b968d36155f56c66b4867c676bdc5..14de83c92fb6fd3ded512b1afd4dcfdbe5e788b9 100644 (file)
@@ -42,7 +42,7 @@ static void __blkif_disconnect_complete(void *arg)
      * must still be notified to the remote driver.
      */
 #ifdef CONFIG_XEN_BLKDEV_GRANT
-    op.host_virt_addr = blkif->shmem_vaddr;
+    op.host_addr      = blkif->shmem_vaddr;
     op.handle         = blkif->shmem_handle;
     op.dev_bus_addr   = 0;
     BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, &op, 1));
@@ -204,7 +204,7 @@ void blkif_connect(blkif_be_connect_t *connect)
 #else
     { /* Map: Use the Grant table reference */
         struct gnttab_map_grant_ref op;
-        op.host_virt_addr = VMALLOC_VMADDR(vma->addr);
+        op.host_addr      = VMALLOC_VMADDR(vma->addr);
         op.flags          = GNTMAP_host_map;
         op.ref            = ref;
         op.dom            = domid;
index edc6c67d1fbd35348d45961ad22cd64f3f48ca28..8be345edea8ecc6d90da2d72de7bdd1e2b0bc687 100644 (file)
@@ -511,9 +511,9 @@ inline static void net_tx_action_dealloc(void)
     gop = unmap_ops;
     while (dc != dp) {
         pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
-        gop->host_virt_addr = MMAP_VADDR(pending_idx);
+        gop->host_addr    = MMAP_VADDR(pending_idx);
         gop->dev_bus_addr = 0;
-        gop->handle = grant_tx_ref[pending_idx];
+        gop->handle       = grant_tx_ref[pending_idx];
         grant_tx_ref[pending_idx] = GRANT_INVALID_REF;
         gop++;
     }
@@ -699,7 +699,7 @@ static void net_tx_action(unsigned long unused)
         /* Packets passed to netif_rx() must have some headroom. */
         skb_reserve(skb, 16);
 #ifdef CONFIG_XEN_NETDEV_GRANT_TX
-        mop->host_virt_addr = MMAP_VADDR(pending_idx);
+        mop->host_addr = MMAP_VADDR(pending_idx);
         mop->dom = netif->domid;
         mop->ref = txreq.addr >> PAGE_SHIFT;
         mop->flags = GNTMAP_host_map | GNTMAP_readonly;
index 4101ca74ddb5be6be7d081052745255865f2c9c2..83fcf9218c0c07b5db4c85d23a68acda5a691761 100644 (file)
@@ -50,7 +50,7 @@ int xc_gnttab_map_grant_ref(int         xc_handle,
     struct gnttab_map_grant_ref op;
     int rc;
 
-    op.host_virt_addr = host_virt_addr;
+    op.host_addr      = host_virt_addr;
     op.dom            = (domid_t)dom;
     op.ref            = ref;
     op.flags          = flags;
@@ -75,7 +75,7 @@ int xc_gnttab_unmap_grant_ref(int       xc_handle,
     struct gnttab_unmap_grant_ref op;
     int rc;
 
-    op.host_virt_addr = host_virt_addr;
+    op.host_addr      = host_virt_addr;
     op.dev_bus_addr   = dev_bus_addr;
     op.handle         = handle;
  
index 943634777986724cbbdf12c75f68daadc3825d6f..7e25dda2f413550abd2602998902a7c96e153f56 100644 (file)
@@ -355,7 +355,7 @@ __gnttab_map_grant_ref(
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
     if ( unlikely(__get_user(dom, &uop->dom) |
                   __get_user(ref, &uop->ref) |
-                  __get_user(host_virt_addr, &uop->host_virt_addr) |
+                  __get_user(host_virt_addr, &uop->host_addr) |
                   __get_user(dev_hst_ro_flags, &uop->flags)) )
     {
         DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
@@ -500,7 +500,7 @@ __gnttab_unmap_grant_ref(
     ld = current->domain;
 
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
-    if ( unlikely(__get_user(virt, &uop->host_virt_addr) |
+    if ( unlikely(__get_user(virt, &uop->host_addr) |
                   __get_user(frame, &uop->dev_bus_addr) |
                   __get_user(handle, &uop->handle)) )
     {
index 3a40b7ca3cd2b0251b8eb9c4db9392d3bb23dad9..b5bec9e229eeba009da362d45dbcee3620998263 100644 (file)
@@ -97,7 +97,7 @@ __gnttab_activate_grant_ref(
      * Returns:
      * .  -ve: error
      * .    1: ok
-     * .    0: ok and TLB invalidate of host_virt_addr needed.
+     * .    0: ok and TLB invalidate of host_addr needed.
      *
      * On success, *pframe contains mfn.
      */
@@ -356,7 +356,7 @@ __gnttab_map_grant_ref(
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
     if ( unlikely(__get_user(dom, &uop->dom) |
                   __get_user(ref, &uop->ref) |
-                  __get_user(addr, &uop->host_virt_addr) |
+                  __get_user(addr, &uop->host_addr) |
                   __get_user(dev_hst_ro_flags, &uop->flags)) )
     {
         DPRINTK("Fault while reading gnttab_map_grant_ref_t.\n");
@@ -512,7 +512,7 @@ __gnttab_unmap_grant_ref(
     ld = current->domain;
 
     /* Bitwise-OR avoids short-circuiting which screws control flow. */
-    if ( unlikely(__get_user(addr, &uop->host_virt_addr) |
+    if ( unlikely(__get_user(addr, &uop->host_addr) |
                   __get_user(frame, &uop->dev_bus_addr) |
                   __get_user(handle, &uop->handle)) )
     {
index a0eee5c957d3ddb5dd8500f56e98d44f1e7882bb..b70bb65856d7be4778ba59697d78cc5ad2a308a1 100644 (file)
@@ -142,7 +142,10 @@ typedef u16 grant_ref_t;
  *  1. If GNTPIN_map_for_dev is specified then <dev_bus_addr> is the address
  *     via which I/O devices may access the granted frame.
  *  2. If GNTPIN_map_for_host is specified then a mapping will be added at
- *     virtual address <host_virt_addr> in the current address space.
+ *     either a host virtual address in the current address space, or at
+ *     a PTE at the specified machine address.  The type of mapping to
+ *     perform is selected through the GNTMAP_contains_pte flag, and the 
+ *     address is specified in <host_addr>.
  *  3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
  *     host mapping is destroyed by other means then it is *NOT* guaranteed
  *     to be accounted to the correct grant reference!
@@ -150,10 +153,7 @@ typedef u16 grant_ref_t;
 #define GNTTABOP_map_grant_ref        0
 typedef struct gnttab_map_grant_ref {
     /* IN parameters. */
-    union {
-        memory_t  pte_addr;
-        memory_t  host_virt_addr;
-    };
+    memory_t    host_addr;
     domid_t     dom;
     grant_ref_t ref;
     u16         flags;                /* GNTMAP_* */
@@ -164,7 +164,7 @@ typedef struct gnttab_map_grant_ref {
 
 /*
  * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
- * tracked by <handle>. If <host_virt_addr> or <dev_bus_addr> is zero, that
+ * tracked by <handle>. If <host_addr> or <dev_bus_addr> is zero, that
  * field is ignored. If non-zero, they must refer to a device/host mapping
  * that is tracked by <handle>
  * NOTES:
@@ -176,10 +176,7 @@ typedef struct gnttab_map_grant_ref {
 #define GNTTABOP_unmap_grant_ref      1
 typedef struct gnttab_unmap_grant_ref {
     /* IN parameters. */
-    union {
-        memory_t  pte_addr;
-        memory_t  host_virt_addr;
-    };
+    memory_t    host_addr;
     memory_t    dev_bus_addr;
     u16         handle;
     /* OUT parameters. */